package com.lk.springboot.dao;

import com.lk.springboot.bean.Press;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author lk
 * @date 2020/1/5 0005 0:16
 */
@Mapper
public interface PressMapper {

    @Select("select * from  Press ")
    List<Press> findAll();

    @Select("select * from  Press where p_name like concat('%',#{p_name},'%')")
    List<Press> findByName(String p_name);

    @Select("select * from  Press where p_person like concat('%',#{p_person},'%')")
    List<Press> findByPerson(String p_person);

    @Insert(" insert into  Press ( p_name , p_person , phone ) values (#{p_name},#{p_person},#{phone}) ")
    public int save(Press press);

    @Delete(" delete from  Press where p_id= #{p_id} ")
    public void delete(int id);

    @Select("select * from  Press where p_id= #{p_id} ")
    public Press get(int id);

    @Update("update  Press set p_name=#{p_name},p_person=#{p_person},phone=#{phone} where p_id=#{p_id} ")
    public int update(Press press);

}
